Skip to content

Align downstream Computer Use readiness and identity hooks#13

Merged
avifenesh merged 1 commit into
mainfrom
align-downstream-codex-app-linux
May 28, 2026
Merged

Align downstream Computer Use readiness and identity hooks#13
avifenesh merged 1 commit into
mainfrom
align-downstream-codex-app-linux

Conversation

@avifenesh
Copy link
Copy Markdown
Collaborator

Summary

  • accept direct /dev/uinput and XDG RemoteDesktop portal as valid development-input readiness backends, not only ydotoold
  • hydrate XAUTHORITY and add same-user graphical PID 1 env fallback for desktop sessions
  • add build-time CUL_* GNOME/DBus identity hooks plus Codex embedded runtime env aliases while keeping standalone defaults

Validation

  • cargo fmt --all -- --check
  • cargo test --locked
  • cargo clippy --locked --all-targets -- -D warnings
  • cargo build --locked
  • scripts/mcp_safety_check.py --binary target/debug/computer-use-linux
  • agnix .
  • node scripts/zod-check/check.mjs --command target/debug/computer-use-linux

@avifenesh avifenesh merged commit b70b07d into main May 28, 2026
20 checks passed
@avifenesh avifenesh deleted the align-downstream-codex-app-linux branch May 28, 2026 07:35
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces build-time GNOME extension and DBus identity overrides, along with runtime environment variable aliases for embedded Codex builds. It also ports downstream Linux readiness and session hydration fixes, allowing direct /dev/uinput and the XDG RemoteDesktop portal to be treated as valid input backends, and carrying XAUTHORITY through environment hydration. The review feedback suggests optimizing the retrieval of the current user's UID in process_owner_matches_current_user by using /proc/self metadata instead of spawning an external process, and removing a redundant !visited_pids.contains(&1) check since PID 1 is never visited in the preceding loop.

Comment thread src/diagnostics.rs
Comment on lines +399 to +406
fn process_owner_matches_current_user(pid: u32) -> bool {
let Some(current_uid) = user_id().and_then(|uid| uid.parse::<u32>().ok()) else {
return false;
};
fs::metadata(format!("/proc/{pid}"))
.ok()
.is_some_and(|metadata| metadata.uid() == current_uid)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Spawning an external process via user_id() (which runs id -u) to determine the current user's UID is inefficient and can be slow. Since /proc/self is owned by the current user on Linux, we can retrieve the current UID directly and efficiently using fs::metadata("/proc/self").map(|m| m.uid()) without spawning any external commands.

fn process_owner_matches_current_user(pid: u32) -> bool {
    let Ok(current_uid) = fs::metadata("/proc/self").map(|m| m.uid()) else {
        return false;
    };
    fs::metadata(format!("/proc/{pid}"))
        .ok()
        .is_some_and(|metadata| metadata.uid() == current_uid)
}

Comment thread src/diagnostics.rs
Comment on lines +372 to +377
if !visited_pids.contains(&1) && process_owner_matches_current_user(1) {
if let Some(process_env) = read_process_environ(1).filter(process_env_has_graphical_display)
{
environments.push(process_env);
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The check !visited_pids.contains(&1) is redundant because the preceding loop breaks immediately if current_pid <= 1 (lines 361-363). Consequently, visited_pids can never contain 1, making this check always evaluate to true. Simplifying this condition improves readability and avoids an unnecessary vector search.

    if process_owner_matches_current_user(1) {
        if let Some(process_env) = read_process_environ(1).filter(process_env_has_graphical_display)
        {
            environments.push(process_env);
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant